package com.atguigu.mediator.smartHouse;

/**
 * @program: design-patterns
 * @author: yangshen
 * @description:
 * @create: 2022-03-09 15:38
 **/
public class Client {
    public static void main(String[] args) {
        //创建一个中介者对象
        Mediator mediator = new ConcreteMediator();

        //创建闹铃Alarm 并且加入到 ConcreteMediator 对象的HashMap
        Alarm alarm = new Alarm(mediator, "Alarm");

        //创建了CoffeeMachine 对象，并  且加入到  ConcreteMediator 对象的HashMap
        CoffeeMachine coffeeMachine = new CoffeeMachine(mediator,"coffeeMachine");

        //创建 Curtains , 并  且加入到  ConcreteMediator 对象的HashMap
        Curtains curtains = new Curtains(mediator, "curtains");
        Tv tv = new Tv(mediator, "Tv");

        //让闹钟发出消息
        alarm.sendMessage(0);
        coffeeMachine.finishCoffee();
        alarm.sendMessage(1);

    }
}
